package com.ruoyi.swimming.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.swimming.domian.SwimmingTicketTimes;
import com.ruoyi.swimming.domian.SwimmingTicketType;
import com.ruoyi.swimming.mapper.SwimmingTicketTimesMapper;
import com.ruoyi.swimming.mapper.SwimmingTicketTypeMapper;
import com.ruoyi.swimming.service.ISwimmingTicketTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;

/**
 * 泳票类型Service业务层处理
 * 
 * @author ruoyi
 * @date 2021-07-17
 */
@Service
public class SwimmingTicketTypeServiceImpl extends ServiceImpl<SwimmingTicketTypeMapper, SwimmingTicketType> implements ISwimmingTicketTypeService
{
    @Autowired
    private SwimmingTicketTypeMapper swimmingTicketTypeMapper;

    /**
     * 查询泳票类型
     * 
     * @param id 泳票类型ID
     * @return 泳票类型
     */
    @Override
    public SwimmingTicketType selectSwimmingTicketTypeById(Long id)
    {
        return swimmingTicketTypeMapper.selectSwimmingTicketTypeById(id);
    }

    /**
     * 查询泳票类型列表
     * 
     * @param swimmingTicketType 泳票类型
     * @return 泳票类型
     */
    @Override
    public List<SwimmingTicketType> selectSwimmingTicketTypeList(SwimmingTicketType swimmingTicketType)
    {
        return swimmingTicketTypeMapper.selectSwimmingTicketTypeList(swimmingTicketType);
    }

    /**
     * 新增泳票类型
     * 
     * @param swimmingTicketType 泳票类型
     * @return 结果
     */
    @Override
    public int insertSwimmingTicketType(SwimmingTicketType swimmingTicketType)
    {
        swimmingTicketType.setCreateTime(DateUtils.getNowDate());
        return swimmingTicketTypeMapper.insert(swimmingTicketType);
    }

    /**
     * 修改泳票类型
     * 
     * @param swimmingTicketType 泳票类型
     * @return 结果
     */
    @Override
    public int updateSwimmingTicketType(SwimmingTicketType swimmingTicketType)
    {
        swimmingTicketType.setUpdateTime(DateUtils.getNowDate());
        return swimmingTicketTypeMapper.updateById(swimmingTicketType);
    }

    /**
     * 批量删除泳票类型
     * 
     * @param ids 需要删除的泳票类型ID
     * @return 结果
     */
    @Override
    public int deleteSwimmingTicketTypeByIds(Long[] ids)
    {
        return swimmingTicketTypeMapper.deleteBatchIds(Arrays.asList(ids));
    }

    /**
     * 删除泳票类型信息
     * 
     * @param id 泳票类型ID
     * @return 结果
     */
    @Override
    public int deleteSwimmingTicketTypeById(Long id)
    {
        return swimmingTicketTypeMapper.deleteById(id);
    }
}
